Passed
Push — develop ( 4586d2...e2c6ed )
by Andrew
04:26
created

webpack.dev.js ➔ ???   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 18
rs 9.7
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
// webpack.dev.js - developmental builds
2
const LEGACY_CONFIG = 'legacy';
0 ignored issues
show
Unused Code introduced by
The constant LEGACY_CONFIG seems to be never used. Consider removing it.
Loading history...
3
const MODERN_CONFIG = 'modern';
0 ignored issues
show
Unused Code introduced by
The constant MODERN_CONFIG seems to be never used. Consider removing it.
Loading history...
4
5
// node modules
6
const path = require('path');
7
8
// webpack plugins
9
const merge = require('webpack-merge');
10
const webpack = require('webpack');
11
12
// config files
13
const pkg = require('./package.json');
14
const common = require('./webpack.common.js');
15
16
// Configure the webpack-dev-server
17
const configureDevServer = () => {
18
    return {
19
        contentBase: './web',
20
        host: '0.0.0.0',
21
        public: pkg.paths.dist.devPublic,
22
        https: false,
23
        hot: true,
24
        hotOnly: true,
25
        overlay: true,
26
        stats: 'errors-only',
27
        watchOptions: {
28
            poll: true
29
        },
30
        headers: {
31
            'Access-Control-Allow-Origin': '*'
32
        }
33
    };
34
};
35
36
// Development module exports
37
module.exports = [
38
    merge(
39
        common.legacyConfig,
40
        {
41
            output: {
42
                filename: path.join('./js', '[name]-legacy.[hash].js'),
43
                publicPath: pkg.paths.dist.devPublic + '/',
44
            },
45
            mode: 'development',
46
            devtool: 'inline-source-map',
47
            devServer: configureDevServer(),
48
        }
49
    ),
50
    merge(
51
        common.modernConfig,
52
        {
53
            output: {
54
                filename: path.join('./js', '[name].[hash].js'),
55
                publicPath: pkg.paths.dist.devPublic + '/',
56
            },
57
            mode: 'development',
58
            devtool: 'inline-source-map',
59
            devServer: configureDevServer(),
60
            plugins: [
61
                new webpack.HotModuleReplacementPlugin()
62
            ],
63
        }
64
    ),
65
];
66